function* fibonacciGenerator() {
    let prev = 0;
    let curr = 1;
    while (true) {
        yield curr;
        const next = prev + curr;
        prev = curr;
        curr = next;
    }
}
const fibonacci = fibonacciGenerator();
//? 生成前10个斐波那契数列
for (let i = 0; i < 10; i++) {
    console.log(fibonacci.next().value);
}
